🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / node / src / commonMain / kotlin / org / meshtastic / feature / node / component / NodeCountSummary.kt
Displaying Raw • Download
feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/component/NodeCountSummary.kt d9b9ce6e8a43ada377ba1e6196d3d3352de20168 (d9b9ce6e) Text, 3.94 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.node.component
Tff7b72import T7ee787androidx.compose.foundation.layout.Arrangement
Tff7b72import T7ee787androidx.compose.foundation.layout.ExperimentalLayoutApi
Tff7b72import T7ee787androidx.compose.foundation.layout.FlowRow
Tff7b72import T7ee787androidx.compose.material3.MaterialTheme
Tff7b72import T7ee787androidx.compose.material3.Text
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.ui.Modifier
Tff7b72import T7ee787androidx.compose.ui.semantics.clearAndSetSemantics
Tff7b72import T7ee787androidx.compose.ui.semantics.contentDescription
Tff7b72import T7ee787androidx.compose.ui.unit.dp
Tff7b72import T7ee787org.jetbrains.compose.resources.stringResource
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.node_count_online
Tff7b72import T7ee787org.meshtastic.core.resources.node_count_shown
Tff7b72import T7ee787org.meshtastic.core.resources.node_count_template
Tff7b72import T7ee787org.meshtastic.core.resources.node_count_total
T8b949e/** Horizontal gap between two count labels that share a line. */
Tff7b72private Tff7b72val Te6edf3LABEL_GAP Tff7b72= T79c0ff1T79c0ff2.Te6edf3dp
T8b949e/** Vertical gap between wrapped lines of count labels. */
Tff7b72private Tff7b72val Te6edf3LINE_GAP Tff7b72= T79c0ff2.Te6edf3dp
T8b949e/**
* Node totals for the Nodes list header: how many nodes are online, how many the current filter shows, and how many are
* known in total.
*
* This used to live in the app bar `subtitle` slot, where it was clipped by the fixed app-bar height and squeezed
* horizontally by the node chip plus two icon buttons — the single long string was ellipsized on most phones
* (issue #6268). Here it gets the full content width and, crucially, is free to grow vertically: each count is an
* independent label inside a [FlowRow], so at large font scales or in verbose locales the labels reflow onto extra
* lines instead of truncating. No `maxLines`, no ellipsis, no autosizing anywhere in this component.
*
* Screen readers get one coherent sentence via [Res.string.node_count_template] rather than three disjointed fragments.
*/
Tf0883e@Composable
Tff7b72fun Td2a8ffNodeCountSummaryTb4b4b4(Te6edf3onlineCountTb4b4b4: Tffa657IntTb4b4b4, Te6edf3shownCountTb4b4b4: Tffa657IntTb4b4b4, Te6edf3totalCountTb4b4b4: Tffa657IntTb4b4b4, Te6edf3modifierTb4b4b4: Te6edf3Modifier Tff7b72= Te6edf3ModifierTb4b4b4) Tb4b4b4{
Te6edf3NodeCountSummaryContentTb4b4b4(
Te6edf3labels Tff7b72=
Te6edf3listOfTb4b4b4(
Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3node_count_onlineTb4b4b4, Te6edf3onlineCountTb4b4b4)Tb4b4b4,
Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3node_count_shownTb4b4b4, Te6edf3shownCountTb4b4b4)Tb4b4b4,
Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3node_count_totalTb4b4b4, Te6edf3totalCountTb4b4b4)Tb4b4b4,
Tb4b4b4)Tb4b4b4,
Te6edf3contentDescription Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3node_count_templateTb4b4b4, Te6edf3onlineCountTb4b4b4, Te6edf3shownCountTb4b4b4, Te6edf3totalCountTb4b4b4)Tb4b4b4,
Te6edf3modifier Tff7b72= Te6edf3modifierTb4b4b4,
Tb4b4b4)
Tb4b4b4}
T8b949e/**
* Layout half of [NodeCountSummary], split out so previews can inject deliberately long strings (long locales) without
* needing a translated resource bundle.
*/
Tf0883e@OptInTb4b4b4(Te6edf3ExperimentalLayoutApiTff7b72::Te6edf3classTb4b4b4)
Tf0883e@Composable
Tff7b72internal Tff7b72fun Td2a8ffNodeCountSummaryContentTb4b4b4(Te6edf3labelsTb4b4b4: Te6edf3ListTff7b72<Tffa657StringTff7b72>Tb4b4b4, Te6edf3contentDescriptionTb4b4b4: Tffa657StringTb4b4b4, Te6edf3modifierTb4b4b4: Te6edf3Modifier Tff7b72= Te6edf3ModifierTb4b4b4) Tb4b4b4{
Te6edf3FlowRowTb4b4b4(
Te6edf3modifier Tff7b72= Te6edf3modifierTb4b4b4.Te6edf3clearAndSetSemantics Tb4b4b4{ Tff7b72thisTb4b4b4.Te6edf3contentDescription Tff7b72= Te6edf3contentDescription Tb4b4b4}Tb4b4b4,
Te6edf3horizontalArrangement Tff7b72= Te6edf3ArrangementTb4b4b4.Te6edf3spacedByTb4b4b4(Te6edf3LABEL_GAPTb4b4b4)Tb4b4b4,
Te6edf3verticalArrangement Tff7b72= Te6edf3ArrangementTb4b4b4.Te6edf3spacedByTb4b4b4(Te6edf3LINE_GAPTb4b4b4)Tb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3labelsTb4b4b4.Te6edf3forEach Tb4b4b4{ Te6edf3label Tff7b72-Tff7b72>
Te6edf3TextTb4b4b4(
Te6edf3text Tff7b72= Te6edf3labelTb4b4b4,
Te6edf3style Tff7b72= Te6edf3MaterialThemeTb4b4b4.Te6edf3typographyTb4b4b4.Te6edf3labelLargeTb4b4b4,
Te6edf3color Tff7b72= Te6edf3MaterialThemeTb4b4b4.Te6edf3colorSchemeTb4b4b4.Te6edf3onSurfaceVariantTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s